Image coding and decoding methods, image coding and decoding apparatuses, and recording media for image coding and decoding programs

ABSTRACT

In an image coding method of the present invention, after a process such as DCT is performed to digital image data, quantization process is performed, and then, to resultant quantized transform coefficients, variable length coding process is performed with reference to a variable length code table showing how variable length codes are allocated, and in a comparison process between an event derived from the quantized transform coefficients and a reference event included in the variable length code table, transformation process is performed to increase a possibility of performing variable length coding with satisfactory coding efficiency.

This application is a continuation of application Serial No. 09/684,322filed Oct. 10, 2000, now U.S. Pat. No. 6,278,801 and a continuation ofapplication Ser. No. 09/091,985 filed Aug. 11, 1998, now U.S. Pat. No.6,345,123 which is a National Stage of PCT/JP97/04037 filed Nov. 6,1997, the priority is of all of which are claimed.

TECHNICAL FIELD

The present invention relates to image coding and decoding methods,image coding and decoding apparatuses, and recording media for imagecoding and decoding programs, more specifically, to an image codingprocess in which a variable coding of high versatility is performed andan image decoding process performed to the result of this image coding.

BACKGROUND ART

Compression coding is essential for efficiently storing or transmittinga digital image. As a method of compressively coding a digital image,used is discrete cosine transformation (DCT) that is a dominanttechnology in typical standards like JPEG (Joint Photographic ExpertsGroup) and MPEG (Moving Picture Experts Group); In addition, waveformcoding methods such as subband coding, wavelet transformation, andfractal are also used as the coding methods as well. To remove redundantsignals between images, intra-frame coding is basically preformed basedon a spatial correlation within one still image; in addition to this,inter-image coding is also performed in which inter-image predictionusing motion compensation is performed based on a temporal correlationbetween each set of adjacent still images, and a difference signalobtained is subjected to waveform coding. Use of the both methods makesit possible to obtain coded data with a high compression ratio.

In the conventional image coding process according to the MPEG standardor the like, after the DCT process or the like, quantization process isperformed, followed by variable length coding process. Morespecifically, a process such as DCT, subband, or wavelet is performed todigital image data, and the transform coefficients obtained by the aboveprocess are quantized using a prescribed quantization scale to generatequantized transform coefficients to which variable length coding processis to be performed.

The quantized transform coefficients obtained by quantization processare arranged in a two-dimensional array, and each coefficient indicateszero or non-zero. In the variable length coding process, zigzag scanningis performed to the coefficients (zero and non-zero) arranged in thetwo-dimensional array in a prescribed scanning order to rearrange thecoefficients in one dimension, and thereafter, events are generated fromthe one-dimensional array of coefficients. Each event consists of a Runthat indicates a number of preceding zero coefficients and a Level thatindicates the value of a non-zero coefficient. Then, coding is performedby referring to a variable length code table prepared in advance inwhich a unique variable length code is allocated to each eventconsisting of a Run and a Level. Moreover, in stead of this method, analternative method may be used, such as a method of allocating anothercode which indicates if a coefficient is a last one, or a method ofperforming coding with reference to a table where variable length codesare allocated to events each consisting of a set of (Run, Level, Last)obtained by adding a Last indicating if a coefficient is a last one to aset of a Run and a Level.

FIG. 18 is a flowchart illustrating the procedure of a prior art codingprocess to an event consisting of (Last, Run, Level). Hereinafter adescription is given of the conventional coding process with referenceto the flow of FIG. 18.

Following the initiation of the process in step 1801, a j-th event isinput as an input event which is an object to be processed. In step1803, comparison is performed between this input event and a referenceevent included in a variable length code table.

FIGS. 19 through 22 show instances of the variable length code tableused for the prior art variable length coding process. As illustrated,in the tables, events each consisting of (Last, Run, Level) correspondto codes. In the figures, “s” in a “VLC CODE” cell indicates zero whenLevel is positive, whereas it indicates 1 when Level is negative.Further, when Last is 0, it indicates that the coefficient concerned isnot the last coefficient.

In step 1803 of FIG. 18, by referring to this variable length codetable, comparison is performed between the input event and eachreference event included in the table consisting of (Last, Run, Level);In step 1804, according to the above comparison process, it is decidedwhether there is a reference event of which (Last, Run, Level) isidentical to that of the input event. When it is decided in step 1804that there is such reference event, step 1805 is performed, whereas,when such a reference event is not found, step 1806 is performed. Atthis point, if step 1805 is performed, a variable length codecorresponding to the reference event is output, followed by step 1807which will be described later.

On the other hand, in the case where step 1806 is performed, that is, inthe case where the (Last, Run, Level) identical to that of the event asan object to be processed cannot be found when the variable length codetable is referred, fixed length coding is performed in step 1806. FIG.23 are diagrams conceptually illustrating fixed length coding. As shownin the figures, the codes shown in FIG. 23(a) are allocated to RUNs andthe codes shown in FIG. 23(b) allocated to Levels, respectively, andthese codes are the results of the coding. In this fixed length codingprocess, a control code for indicating that a result of the coding is afixed-length code is added in such a way that it is transmitted prior tothe result of the coding, so as to distinguish the code obtained byfixed length coding from the code obtained by variable length coding.This control code is called “escape code (ECS)”, and in this case, acode “0000011” shown in FIG. 22 is used as the control code. Morespecifically, when fixed length coding is performed, coded data isobtained comprising a 7-bit ESC code and the code thus allocatedsubsequent to the ESC code.

Following the performance of step 1805 or step 1806, in the subsequentstep 1807, it is decided whether an input event processed is a lastinput event or not, and if it is decided that the event is the last one,the coding process is completed in step 1808. On the other hand, if itis decided that the event is not the last one, j is incremented by 1 instep 1809 and the operation returns to step 1802, whereby a next inputevent is processed in the same manner. Thus, the process is continued tothe last non-zero coefficient.

As described above, in the prior art image coding process, events aregenerated for quantized transform coefficients and comparison is madebetween the event and a reference event included in a variable lengthcode table; if the matching event is found, a variable length codederived from the table is used, whereas, if no matching event is found,a result of fixed length coding, to which a control code (ESC code) isadded, is used.

Generally, a variable length code table is formed by investigatingstatistical distribution using numeral images and allocating shortercodes to the events occurring most frequently, whereby the overallcompression ratio is improved. As described above, if coding is notperformed using a variable length code table, fixed length coding isperformed and the compression ratio is thus degraded; Therefore, it isdesired to make a setting which hardly causes fixed length coding. Inthe prior art image coding, as shown in FIG. 18, if it is decided instep 1804 that there is no reference event concerned, fixed lengthcoding is immediately performed in step 1806, which means that a rate ofperforming variable length coding with better coding efficiency isdirectly decided by a rate at which an event concerned is present in avariable length code table.

In image compression coding, however, the statistical distribution ofcoefficients varies according to the quantization scale, and it isunderstood that the distribution of coefficients having high compressionratio differs considerably from that having low compression ratio.Therefore, when an appropriate variable length code table is not usedfor coefficients as objects, the rate at which the event concerned ispresent in the variable length code table is decreased and the rate ofperforming fixed length coding is increased, resulting in reduced codingefficiency.

Generally, as the quantization scale is increased, the compression ratioof quantized transform coefficients is increased, but the event derivedfrom such quantized transform coefficients tends to have a smaller valueof Level. The variable length code table shown in FIGS. 19 to 22includes many events having small Level values to which short codes areallocated, and is suitable for use in the case where quantized transformcoefficients having relatively high compression ratio are used asprocessing objects. Therefore, if the quantization scale is small andthe compression ratio of quantized transform coefficients is low, manyof the events derived have large Level values. So, the rate at which anevent concerned is not present in such variable length code table isincreased and the events present in the table are often allocatedrelatively long codes, resulting in increased bit number of the resultof the coding. In other words, employing a variable length code tableformed for low compression ratio in coding at high compression ratioleads to decrease in coding efficiency.

As described above, when a variable length code table set properly isnot used for the coefficients which are the processing objects ofvariable length coding, since variable length coding cannot be performedand fixed length coding is performed more frequently, and the amount ofbits is increased even when variable length coding is performed, theamount of code is increased and improvement of compression ratio isprevented, which is a problem of the prior art image coding process.

DISCLOSURE OF THE INVENTION

The present invention is proposed in view of the above-describedproblems, and has an object to realize that in image coding, any objectof coding in a wide range, which ranges from the one having highcompression ratio to the one having low compression ratio, is coded withimproved efficiency using a single variable length code table.

To solve the above-described problems, provided is an image codingmethod of the present invention in which transform coefficients areobtained for an image to be coded by a prescribed transformation method,quantization process is performed to the transform coefficients using aprescribed quantization scale to obtain quantized transformcoefficients, and variable length coding process is performed to thequantized transform coefficients referring to a variable length codetable comprising a plurality of reference events paired with variablelength codes, and the method includes: a first variable length codingstep of obtaining a first result of comparison by comparison processbetween the quantized transform coefficient and a reference eventincluded in the variable length code table, and if the first result ofcomparison shows “matching”, obtaining a first result of coding using avariable length code corresponding to the reference event; a secondvariable length coding step of, if the first result of comparison doesnot show “matching”, obtaining a second result of comparison bycomparison process between the quantized transform coefficient and areference event included in the variable length code table subject to atransformation process using a prescribed function, and if the secondresult of comparison shows “matching”, obtaining a second result ofcoding which is distinguishable from the first result of coding using avariable length code corresponding to the reference event; and aparticular coding step of, if the second result of comparison does notshow “matching”, performing coding process to the quantized transformcoefficient using a prescribed coding system to obtain a result ofcoding which is distinguishable from each of the first and secondresults of coding; therefore, a rate of performing variable lengthcoding is raised, and a compression ratio of resultant coded data isincreased, thereby improving efficiency of coding process using avariable length code table.

Another image coding method of the present invention in which transformcoefficients are obtained for an image to be coded by a prescribedtransformation method, quantization process is performed to thetransform coefficients using a prescribed quantization scale to obtainquantized transform coefficients, and variable length coding process isperformed to the quantized transform coefficients referring to avariable length code table comprising a plurality of reference eventspaired with variable length codes, includes a variable length codingstep which comprises the steps of: performing division process to thequantized transform coefficient using a divisor decided based on thequantization scale, to obtain a quotient and a remainder; obtaining aresult of comparison with quotient by comparison process with areference event included in the variable length code table, using thequotient; and, if the result of comparison with quotient shows“matching”, employing a variable length code corresponding to thereference event and adding an auxiliary code obtained by performingcoding process to the remainder using a prescribed coding system, toobtain a result of coding; The transformation process using divisionincreases a matching rate in comparison, thereby improving efficiency ofcoding process utilizing a variable length code table.

Still another image coding method of the present invention is an imagecoding method in which transform coefficients are obtained for an imageto be coded by a prescribed transformation method, quantization processis performed to the transform coefficients using a prescribedquantization scale to obtain quantized transform coefficients, andvariable length coding process is performed to the quantized transformcoefficients referring to a variable length code table comprising aplurality of reference events paired with variable length codes,wherein, a variable length coding step is performed which comprises thesteps of: performing transformation process with a prescribed functionto a reference event included in the variable length code table, basedon the quantization scale, to generate a transformed event; obtaining aresult of transformation comparison by comparison process between thequantized transform coefficient and the transformed event; and, if theresult of transformation comparison shows “matching”, obtaining a resultof coding using a variable length code corresponding to the referenceevent based on which the transformed reference event is generated; thetransformation process applied to a reference event included in avariable length code table raises a matching rate in comparison, therebyimproving efficiency of coding process utilizing a variable length codetable.

According to the present invention which is described above, an effectis available that a wide range of images (ranging from the one having ahigh compression ratio to the one having a low compression ratio) can becoded with improved efficiency, using a single variable length codetable.

Further, the image coding apparatus of the present invention can obtaina result of coding having high compression ratio by implementing theabove-described image coding method.

Furthermore, in an image decoding method of the present invention,appropriate decoding process is performed to the result of codingobtained by the above image coding method.

Still furthermore, the image decoding apparatus of the present inventioncan perform appropriate decoding process to the result of codingobtained by the above image coding apparatus.

Moreover, a recording medium for image coding program of the presentinvention, when an image coding program implementing the above-describedimage coding method is recorded, implements an image coding apparatuscapable of obtaining results of coding with high compression ratioutilizing a device resource, by running the program on a computersystem.

In addition, a recording medium for image decoding program of thepresent invention, when an image decoding program implementing theabove-described image decoding method is recorded, implements an imagedecoding apparatus capable of performing appropriate decoding process toresults of coding with high compression ratio utilizing a deviceresource, by running the program on a computer system.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flowchart illustrating the procedure of a variable lengthcoding method according to a first embodiment of the present invention.

FIG. 2 is a block diagram illustrating the configuration of an imagecoding apparatus according to the same embodiment.

FIGS. 3(a)-3(b) are explanatory diagrams illustrating examples of a codetransformed by the variable length coding method according to the sameembodiment.

FIG. 4 is a block diagram illustrating the configuration of an imagedecoding apparatus according to the same embodiment.

FIG. 5 is a flowchart illustrating the procedure of a variable lengthdecoding method according to the same embodiment.

FIG. 6 is a flowchart illustrating the procedure of a variable lengthcoding method according to a second embodiment of the present invention.

FIG. 7 is a flowchart illustrating the procedure of a variable lengthdecoding method according to the same embodiment.

FIGS. 8(a)-8(b) are flowcharts illustrating the procedure of a variablelength coding method according to a third embodiment of the presentinvention.

FIG. 9 is a flowchart illustrating the procedure of a variable lengthdecoding method according to the same embodiment.

FIG. 10 is a flowchart illustrating the procedure of a variable lengthcoding method according to a fourth embodiment of the present invention.

FIG. 11 is a flowchart illustrating the procedure of a variable lengthdecoding method according to the same embodiment.

FIG. 12 is a flowchart showing the procedure of a variable length codingmethod according to a fifth embodiment of the present invention.

FIGS. 13(a)-13(b) are diagrams illustrating relations betweenquantization scales and divisors used for transformation process in thevariable length coding method according to the same embodiment.

FIG. 14 is a flowchart illustrating the procedure of a variable lengthdecoding method according to the same embodiment.

FIG. 15 is a flowchart illustrating the procedure of a variable lengthcoding method according to a sixth embodiment of the present invention.

FIG. 16 is a block diagram illustrating the inner configuration of avariable length coder included in the image coding apparatus accordingto the same embodiment.

FIG. 17 is a block diagram illustrating the inner configuration of avariable length decoder included in the image decoding apparatusaccording to the same embodiment.

FIG. 18 is a flowchart illustrating the procedure of a prior artvariable length coding method.

FIGS. 19 through 22 are diagrams showing examples of variable lengthcode table used for variable length coding.

FIGS. 23(a)-23(b) are diagrams for explaining fixed length codingprocess.

BEST MODES FOR CARRYING OUT THE INVENTION

Embodiment 1

An image coding method according to a first embodiment of the presentinvention is intended to increase chances of using a variable lengthcode table by performing transformation process to events which areobjects to be coded, thereby improving coding efficiency.

FIG. 1 is a flowchart showing the procedure of a variable length codingmethod according to the first embodiment of the present invention.Further, FIG. 2 is a block diagram illustrating the configuration of animage coding apparatus performing the variable length coding processaccording to the first embodiment, and FIG. 3 are diagrams showingexamples of the result of the variable length coding.

Initially, a description is given of the image coding apparatusaccording to the first embodiment, using FIG. 2. As shown in the figure,the image coding apparatus according to the first embodiment comprises:a first adder 202, a coder 203, a second adder 210, a variable lengthcoder (VLC) 211, a frame memory (FM) 213, a motion extractor (ME) 214,and a motion compensator (MC) 215, and it receives from an inputterminal 201 digital image data which is an object of coding process andoutputs from an output terminal 206 the coded data which is the outputof the image coding apparatus. The coder 203 contains a discrete cosinetransformation unit (DCT) 204 and a quantizer (Q) 205, and the decoder207 also contains an inverse quantizer (IQ) 208 and an inverse discretecosine transformation unit (IDCT) 209.

Hereinafter a description is given of the operation of the image codingapparatus thus constructed. First of all, an image to be coded, which isdigital image data, is input to the input terminal 201. The image to becoded is divided into a plurality of adjacent small regions. In thefirst embodiment, an image to be coded is divided into a plurality ofadjacent 16×16 blocks and coding process is performed for each of thedivided blocks.

An object block, which is a block as an object to be coded, is input tothe first adder 202 through a line 216 as well as to the motionextractor 214 through a line 225. Further, the frame memory 213 stores aprevious reconstructed image, which will be described later, and themotion extractor 214 receives the stored image through a line 224 andperforms motion extraction process to the object block to be coded usingthe image as a reference image, to obtain a motion vector. In the motionextraction process, motion displacement information which gives aprediction signal of minimum error to an object block to be coded isobtained by block matching or other method, and the motion displacementinformation is treated as a motion vector. The motion extractor 214outputs the motion vector to the motion compensator 215. The motionvector is also output through a line 228 to the variable length coder211 where it is transformed into a variable length code and added to aresult of coding as a part of side information.

The motion compensator 215 also uses the image stored in the framememory 213 as a reference image, generates a predicted block from thisreference image and the motion vector and outputs it to the first adder202 through a line 226 as well as to the second adder 210 through a line227. The first adder 202 derives a difference between the input objectblock and the input predicted block to generate a difference block, andoutputs it to the coder 203 through a line 217.

The difference block is compression-coded at the coder 203. In the firstembodiment, the difference block is input to the discrete cosinetransformation unit 204 and transformed into coefficients in a frequencydomain; the coefficients in the frequency domain are input through aline 218 to the quantizer 205 which performs quantization process usinga prescribed quantization scale. When the first adder 202 does notderive a difference, that is, intra-image coding is performed, theobject block is input to the coder 203 where it is processed in the samemanner in which the difference block is processed.

Quantized transform coefficients and the quantization scale used for thequantization process are output from the quantizer 205 through a line219 to the variable length coder 203 where coding process is performedand the result of coding is output together with the side informationincluding the motion vector and the quantization scale to an outputterminal 206. The quantized transform coefficients are, at the sametime, output to the decoder 207 where expansion process is performed. Inthe first embodiment, inverse quantization is performed using the abovequantization scale in the inverse quantizer 208 and the result is inputthrough a line 221 to the inverse discrete cosine transformation unit209 where spatial domain data is derived by an inverse of discretecosine transformation process. The difference block obtained byexpansion in the decoder 207 is output through a line 221 to the secondadder 210 where a predicted block transmitted through a line 227 isadded to generate a reconstructed block. This reconstructed block isoutput through a line 222 to the frame memory 213 and stored therein tobe used as a reference image in the subsequent coding process.

In the image coding apparatus of the first embodiment, the variablelength coder 211 receives, as inputs, quantized transform coefficientsand side information which includes quantization scale, motion vector,and others, and transforms them into variable length codes or fixedlength codes. Hereinafter a description is given of the operation forthe process to quantized transform coefficients by the variable lengthcoder 211, with reference to the flow of FIG. 1.

As described in the explanation for the prior art, transformcoefficients are obtained in a form of two-dimensional array which iscomposed of zero coefficients and non-zero coefficients; for thistwo-dimensional array, rearrangement is performed in a prescribed order(in zigzags) to obtain a one-dimensional array, and events are made eachconsisting of a number of proceeding zero coefficients (Run) and a valueof non-zero coefficient (Level). Further, Last is added which is theinformation indicating whether a transform coefficient represented byLevel is the last coefficient in a block or not. An event thus formedwhich consists of (Last, Run, Level) is treated as an input event whichis an object to be processed by the variable length coder 211.

Following the initiation of the process in step 101, a j-th input eventis obtained in step 102. In step 103, comparison is performed betweenthe input event and a reference event present in a variable length codetable in the variable length coder 211. As for the variable length codetable, the tables of FIGS. 19 to 22 used in the prior art are used, andcomparison is performed with each reference event included in the tableand consisting of (Last, Run, Level).

In step 104, it is decided whether a reference event having a matching(Last, Run, Level) is found in the above comparison process or not. Whenit is decided in step 104 that the reference event is found, step 105 isperformed, and when it is not found, step 106 is performed. At thispoint, if step 105 is performed, a variable length code corresponding tothe reference event is output, followed by step 111.

On the other hand, if step 106 is performed, transformation processusing a prescribed function is performed to the Level included in theinput event to generate a transformed input event. In step 107 whichfollows, comparison is performed between a transformed input event and areference event as in the case of step 103. In step 108 which follows,it is decided whether a matching reference event is found or not, andwhen a reference event is found, step 110 is performed, and when it isnot found, step 109 is performed. At this point, if step 110 isperformed, a result of coding is output which is the variable lengthcode corresponding to the reference event to which a second control codeuniquely set in advance is added, followed by step 111.

On the other hand, if step 109 is performed, the coding process as shownin FIG. 23 is performed to the input event to generate a fixed lengthcode. Then, a result of coding is output which is the fixed length codeto which a first control code distinguishable from the second controlcode is added.

If either step 110 or step 109 is performed, in a step 111 whichfollows, it is decided whether an input event processed is a last inputevent or not, and if the event is the last one, the coding process iscompleted in step 112. On the other hand, when the event is not the lastone, j is incremented by 1 in step 113, and the operation returns tostep 102, whereby a next input event is processed in the same manner.Thus, the process is continued to the last non-zero coefficient.

In the first embodiment, a process of deduction of an Offset valuehaving a prescribed value is used as a prescribed function for obtaininga transformed input event from the input event. More specifically, atransformed input event is derived by deducing an Offset from the valueof Level of the input event. It is preferable to deduct an Offset fromthe absolute value of Level and then append a sign code of Level(positive or negative). The offset may be a single value, or it may havea variable value corresponding to values of Last and Run. In the firstembodiment, this can be obtained from the table of FIGS. 19 to 22 insuch a way that the maximum Level value for each set of (Last, Run) isused as an Offset value: for example, Offset=12 for (Last, Run)=(0,0),Offset=6 for (Last, Run)=(0,1), and Offset=4 for (Last, Run)=(0,2).

The variable length code table shown in FIGS. 19 to 22 is suitable fortransform coefficients having relatively high compression ratio, andmany of the Levels included in the events within the table have smallvalues. Therefore, for an input event whose matching event is notpresent in the table, the deduction process is performed to the Levelvalue thereof to obtain a transformed input event having a small Levelvalue, thereby increasing the rate of performing variable length codingas well as the rate of using short codes allocated to the events havingsmall Level values in the table.

Further, as a first control code, “0000011” is used which is identicalto the ESC code shown in FIG. 23 used in the prior art; as a secondcontrol code, the ESC code repeated twice is used.

FIG. 3 are diagrams illustrating examples of the result of the coding.Here the coding process according to the first embodiment is comparedwith the prior art coding process, using FIG. 3. Now it is consideredthat an event having (Last, Run, Level)=(0, 0, 13) is an object to becoded. The variable length code table shown in FIGS. 19 to 22 does nothave this set, (0, 0, 13). Therefore, if the prior art coding processshown in FIG. 23 is performed as described above, the fixed lengthcoding process shown in FIG. 23 is performed as described above, and ESCcode is added to this to be output. FIG. 3(a) shows the result of thisprocess, and 6 bits 303 and 8 bits 304 both representing Levels areoutput subsequent to 7 bits 301 as ESC code and 1 bit 302 representingLast. Therefore, Levels are represented by 303 showing zero-run and thefixed length code 304. Thus, 22 bits are required in total.

On the other hand, in the result of the process according to the firstembodiment, when the reference event concerned is not present in thevariable length code table in steps 103 through 104 of the flow of FIG.1, fixed length coding is not performed immediately unlike the case ofthe prior art, and transformation process and comparison are performedagain as shown in steps 106 through 108. In the transformation process,transformation is performed by deducting Offset (=12) from the Levelvalue 13 to obtain a Level value of 1, there by obtaining a transformedinput event, (0, 0, 1). As shown in FIG. 18, since the event (0, 0, 1)is provided in the variable length code table, step 110 following step108 is performed. Therefore, as shown in FIG. 3(b), the result of thecoding is derived comprising a second control code 305 and a variablelength code 306 corresponding to (0, 0, 1). Therefore, in this case, 17bits are required in total, which means that the amount of code isreduced in comparison with the prior art case requiring 22 bits.

In the flow of FIG. 1, when a reference event concerned is not presentin the variable length code table in the comparison process using thetransformed input event, the process in step 109 is identical to that inthe prior art. Therefore, in the first embodiment, at worst case, thecoding identical to the prior art one can be performed. When the lengthof code to which the second control code is added is longer than that ofthe code to which the first control code is added, less number of bitscan be obtained by coding with a first control code and a fixed lengthcode.

Hereinafter a description is given of a decoding process to the codeddata obtained by the image coding process according to the firstembodiment.

FIG. 4 is a block diagram illustrating the configuration of an imagedecoding apparatus according to the first embodiment. As shown in FIG.4, the image decoding apparatus according to the first embodimentcomprises: a data analyzer (DA) 402, an adder 406, a variable lengthdecoder (VLD) 408, a decoder 403, a frame memory (FM) 409, and a motioncompensator (MC) 410, and it receives coded data which is an object ofdecoding process from an input terminal 401 and outputs decoded datawhich is the apparatus output of the image decoding apparatus from anoutput terminal 407. Further, the decoder 403 contains an inversequantizer (IQ) 404 and an inverse discrete cosine transformation unit(IDCT) 405.

As for the image decoding apparatus of the first embodiment which isconstructed above, a description is given of the operation forperforming the decoding process to coded data which has beencompression-coded by the image coding apparatus shown in FIG. 2.

Coded data as an object to be processed is input to the input terminal401, and then analyzed by the data analyzer 402 to derive a variablelength code according to quantized transform coefficients, and the codesof the side information including quantization scale and motion vector.Among them, the quantization scale and the variable length code of thequantized transform coefficients are transmitted to the variable lengthdecoder 408 through a line 412, and the motion vector to the motioncompensator 410 through a line 418. In the variable length decoder 408,the variable length code of the quantized transform coefficients isdecoded into transform coefficients by referring to the variable lengthcode table, and then the coefficients are rearranged to obtaincompressed difference blocks and the blocks are output to the decoder403.

In the decoder 403, the compressed difference block is expanded togenerate a difference block. In the decoder 403 of the first embodiment,inverse quantization is performed using a quantization scale in theinverse quantizer 404, and the inverse discrete cosine transformationunit 405 performs transformation to the result so that afrequency-domain signal is transformed to a spatial domain signal. Thissignal is output as a difference block to an adder 406.

On the other hand, in the motion compensator 410 receiving the motionvector as an input, an address is generated based on the motion vector,for use to access a frame memory 409, and with respect to the imagestored in the frame memory 409, a predicted block is generated. Thepredicted block generated is output to the adder 406 where additionprocess is performed between it and the difference block obtained byexpansion to generate a reconstructed block. The image thusreconstructed is output from the output terminal 407 as the output ofthe image decoding apparatus, as well as to the frame memory 409 to bestored therein.

FIG. 5 is a flowchart showing the procedure of the variable lengthdecoding method by the variable length decoder 408. Hereinafter adescription is given of the operation of the coefficient variable lengthdecoder 408 in the decoding process, with reference to the flow of FIG.5.

Initially, following the initiation of the process in step 501, avariable length code obtained based on quantized transform coefficients,which is a j-th object to be processed, is input as an input variablelength code. In step 503, it is decided whether the input variablelength code includes a control code or not, and if it does not include acontrol code, step 504 is performed; if it includes the code, step 505is performed. In the case where step 504 is performed, that is, in thecase where no control code is included, a set of (Last, Run, Level)corresponding to the input variable length code is output by referringto the variable length code table, followed by step 510 which will bedescribed later.

On the other hand, in the case where step 505 is performed, that is, inthe case where a control code is included, it is decided whether thecontrol code is a second control code or not; if it is the secondcontrol code, step 506 is performed, and if it is not that code, step507 is performed. In the case where step 506 is executed, that is, inthe case where the control code is a second control code, a set of(Last, Run, Level) corresponding to the input variable length code isobtained by using the variable length code table, and the Level valuethereof is transformed with a predetermined function and the result isoutput, followed by step 510 which will be described later. In the firstembodiment, a process of adding a predetermined Offset is performed, thevalue of this Offset varies according to a set of (Last, Run) asdescribed above.

Here taken into account is the decoding process to the code shown inFIG. 3(b). If it is decided in step 505 that it is a second controlcode, step 506 is performed. Therefore, a set of (Last, Run, Level)corresponding to a part of the code, “100”, which is shown as 306 inFIG. 3(b), can be obtained by referring to the variable length codetable, and Offset=12 is added to this Level to regenerate the originalset, (Last, Run, Level)=(0, 0, 13).

On the other hand, if step 507 is executed, it is also decided whetherthe control code is a first control code or not. If it is the firstcontrol code, step 508 is performed, but if it not the first controlcode, it is understood that the control code other than first and secondcontrol codes has been added. Therefore, in step 509, the decodingprocess is stopped or an error processing such as letting the user knowthat the decoding process is stopped. On the other hand, in the casewhere step 508 is performed, that is, in the case where it is a firstcontrol code, it is decoded as a fixed length code to regeneratecoefficients.

If any of the steps 504, 506, and 508 is performed, in step 510 whichfollows, it is decided whether the processed input variable length codeis the last one or not, and if it is the last one, the coding process iscompleted in step 511. On the other hand, if it is not the last one, theoperation is returned to step 502 after j is incremented by 1, whereby anext input variable length code is processed in the same manner. Thus,the process is continued to the last variable length code.

As described above, according to the first coding method of the firstembodiment, as shown in FIG. 1, if the reference event concerned is notincluded in the variable length code table in the comparison process insteps 103 through 104, the transformation process to the input event isperformed in step 106, and in steps 107 through 108, comparison processis performed with the resultant transformed input event. Therefore, therate of performing fixed length coding in step 109 can be reduced, andthe possibility that short codes are allocated in variable length codingis increased by using the transformed input event, resulting in improvedcompression ratio of the result of coding as a whole.

Further, since the image coding apparatus of the first embodimentcomprises the variable length coder 211 performing the above-describedcoding method, a result of coding with a high compression ratio can beobtained by using a single variable length code table whether thecompression ratio of the compression coding in the coder 203 is high orlow.

Furthermore, the image decoding method and image decoding apparatusaccording to the first embodiment are able to perform appropriatedecoding process according to the result of coding obtained in theabove-described manner to obtain reconstructed image.

Although it is described that, in the coding process depicted in thefirst embodiment, discrete cosine transformation is performed forcompression coding, waveform coding such as wavelet coding may beapplied instead of it and enables performing the same coding process.

Further, although in the coding process described in the firstembodiment, a Level value of an input event is transformed in thetransformation process for the input event, a Run value of the inputevent may be transformed instead. In this case, the maximum Run valuecorresponding to the set of (Last, Level) of each reference event in thevariable length code table of FIGS. 19 to 22 is used as an Offset value,and (Offset+1) is deducted from the Run value of an input event toobtain a transformed input event. The transformation process may also beperformed by other method such as multiplying a Level value or a Runvalue, performing a process using a quadratic function, or changing adynamic range. It is also possible to transform a Level or a Run in avariable length code table with a prescribed function and then performcompression process, in place of performing a prescribed function to aLevel or a Run of an input event.

As described above, when a Run value is transformed in coding processinstead of a Level value, (Offset+1) is added to the Run value subjectedto variable length decoding to generate an original Run value. In thiscase, the Offset value is the maximum Run value corresponding to a setof (Last, Level), as explained above.

Although in the first embodiment a description is given of theprocedures of the coding and decoding processes with reference to theflowcharts of FIGS. 1 and 5, the coding and decoding processes are notlimited to these procedures, and the procedures enabling the sameprocesses can also improve coding efficiency and implement a suitabledecoding process to the result of the coding.

Embodiment 2

In an image coding method according to a second embodiment of thepresent invention, transformation process is performed to an event as anobject to be coded, as in the first embodiment, and the number of bitscan be reduced by using mode code.

FIG. 6 is a flowchart showing the procedure of a variable length codingmethod according to the second embodiment. The image coding apparatus ofthe second embodiment also has the same configuration as that of thefirst embodiment, and thus FIG. 2 will be used for the description.

The image coding process according to the second embodiment differs fromthat of the first embodiment only in the process by the variable lengthcoder 211 shown in FIG. 2, and thus a description is given of theoperation by the variable length coder 211 in the coding process belowwith reference to FIG. 6.

Steps 601 through 608 are performed in the same manner as steps 101through 108 in the first embodiment, and in step 108, decision is madebased on a comparison between a transformed input event and a referenceevent of a variable length code table. If it is decided that there is amatching reference event, step 610 is performed; if such event is notfound, step 609 is performed.

If step 610 is performed, a result of coding is output which is avariable length code corresponding to the reference event to which acontrol code set uniquely in advance and a second mode code are added,followed by step 611. Here, “0000011”, which is identical to the ESCcode shown in FIG. 22, is used as a control code, and “0” is used as thesecond mode code.

On the other hand, if step 609 is performed, the coding process shown inFIG. 23 is performed to an input event to generate a fixed length code.Then, a result of coding is output which is the fixed length code towhich a control code and a first mode code are added. “1” is used as afirst mode code.

If either step 610 or step 609 is performed, in a subsequent step 611,it is decided whether an input event processed is a last input event ornot, and if the event is the last one, the coding process is completedin step 612. On the other hand, if the event is not the final one, theoperation returns to step 602 after j is incremented by 1 in step 613,whereby a next input event is processed similarly. Thus, the process iscontinued to the last non-zero coefficient.

In the second embodiment, transformation is performed using an Offsetcorresponding to a Level of an input event to generate a transformedinput event. As in the first embodiment, the Offset may take a fixedvalue or a variable value corresponding to a set of a Last and a Run. Inthis embodiment, used as an Offset is the maximum Level valuecorresponding to each set of (Last, Run) obtainable from the variablelength code table shown in FIGS. 19 through 22, in such a way thatOffset=12 for (Last, Run)=(0,), Offset=6 for (Last, Run)=(0,1), andOffset=4 for (Last, Run) (0,2).

Hereinafter a description is given of a decoding process to the codeddata obtained in the image coding process illustrated in the secondembodiment. The configuration of the image decoding apparatus accordingto the second embodiment is identical to that of the first embodiment,and thus FIG. 4 will be used for the description.

FIG. 7 is a flowchart showing the procedure of a variable lengthdecoding method according to the second embodiment. The image decodingprocess according to the second embodiment differs from that of thefirst embodiment only in the process of the variable length decoder 408shown in FIG. 4, and thus the operation by the variable length decoder408 in the decoding process is described below with reference to FIG. 7.

Steps 701 though 704 are performed in the same manner as steps 501through 504 according to the first embodiment (see FIG. 5), and thendecision process is performed in step 705. If it is decided in step 703that a control code is found, a decision process is performed to knowwhether a next one bit subsequent to the control code is “0” or “1”.Then, if the bit is “0”, step 706 is performed, and if the bit is “1”,step 708 is performed.

If step 706 is performed, a set of (Last, Run, Level) corresponding toan input variable length code is obtained using a variable length codetable, and transformation process is performed using a prescribedfunction corresponding to the Level value, and then the result of thedecoding is output. In the transformation process of the secondembodiment, a prescribed Offset is added to an obtained Level value. TheOffset value takes a variable value corresponding to a set of (Last,Run), as described above.

On the other hand, if step 708 is performed, an input variable lengthcode is decoded as a fixed length code to regenerate coefficients. Ifany of steps 704, 706, and 708 is performed, in a subsequent step 710,it is decided whether an input variable length code processed is thelast input variable length code or not, and if the code is the last one,the coding process is completed in step 711. On the other hand, if it isnot the last one, the operation is returned to step 702 after j isincremented by 1 in step 712, whereby a next input variable length codeis processed in the same manner. Thus, the process is continued to thelast variable length code.

As described above, in the image coding method according to the secondembodiment, if a matching reference event is not present in a variablelength code table in the comparison process in steps 603 through 604,transformation process is performed to an input event in step 606, andin steps 607 through 608, comparison process is performed using atransformed input event obtained, as shown in FIG. 6; therefore, a rateof performing fixed length coding in step 609 is reduced, and apossibility that short codes are allocated in variable length coding isincreased due to use of a transformed input event, resulting in improvedtotal compression ratio of a result of coding. Moreover, since a one-bitmode code is used in step 609 or step 610 to make a distinction betweenfixed length coding and a Level subjected to Offset process, a merit isavailable that a total number of bits of the result of coding can bereduced in comparison with the case of the first embodiment where firstand second control codes are used.

Further, since the image coding apparatus according to the secondembodiment comprises the variable length coder 211 performing theabove-described coding method, a result of coding with an improvedcompression ratio can be obtained using a single variable length codetable whether the compression ratio of the compression coding at thecoder 203 is high or low.

Furthermore, the image decoding method and image decoding apparatusaccording to the second embodiment enable performing appropriatedecoding process corresponding to the result of coding derived in theabove-described manner to obtain reconstructed image.

Although in the second embodiment only one mode code is used, two ormore mode codes may be used to distinguish plural modes. For example, amode in which a value of a run of zero is changed may be added as athird mode.

Although in the second embodiment a Level of an input event istransformed to obtain a transformed input event as in the firstembodiment, it is possible to transform a Run thereof. Further, althoughtransformation process is performed using an Offset here, other methodmay be used such as multiplying a Level, subjecting to aquadraticfunction, and changing a dynamic range.

Embodiment 3

In an image coding method according to a third embodiment of the presentinvention, transformation process is performed to an event which is anobject to be coded, as in the first and second embodiments, and codingefficiency can be improved by performing transformation processrepetitively.

FIG. 8 are flowcharts showing the procedure of a variable length codingmethod according to the third embodiment. An image coding apparatus ofthe third embodiment has the same configuration as that of the firstembodiment, too, and thus FIG. 2 will be used for the description.

The image coding process according to the third embodiment differs fromthat of the first embodiment only in the process by the variable lengthcoder 211 shown in FIG. 2, and thus a description is given of theoperation by the variable length coder 211 in the coding process belowwith reference to FIG. 8.

In the flow of FIG. 8(a), steps 801 through 805 are performed in thesame manner as steps 101 through 105 of the first embodiment. In thethird embodiment, in the transformation process in step 806, a firsttransformed input event is obtained by transformation process using aprescribed function. Here, the transformation process is performed inthe same manner as in the first embodiment, and a first transformedinput event is obtained by deducting a prescribed Offset from a Levelvalue included in an input event. In this case, the maximum Level valuecorresponding to each set of (Last, Run) available in the variablelength code table shown in FIGS. 19 to 22 is used as an Offset: forexample, Offset=12 for (Last, Run)=(0, 0), Offset=6 for (Last, Run)=(0,1), and Offset=4 for (Last, Run)=(0, 2).

In step 807, comparison is performed between a first transformed inputevent and a reference event included in the variable length code table,and in step 808, decision is made based on the comparison. If it isdecided in step 810 that a matching reference event is found, step 810is performed, and if not found, the procedure shown in FIG. 8(b) isperformed. When step 810 is performed, a result of coding is outputwhich is a variable length code corresponding to the reference event towhich a control code set uniquely in advance and a second mode code areadded, followed by step 811. Here, “0000011”, which is identical to theESC code shown in FIG. 22, is used as a control code, and “0” is used asa second mode code.

On the other hand, when the procedure shown in FIG. 8(b) is performed, aRun of an input event is transformed using a prescribed function toderive a second transformed input event. In the third embodiment, aprescribed value Offset is deducted from a Run value to generate asecond transformed input event having a new Run value. In this case, themaximum Run value corresponding to each set of (Last, Level) in thevariable length code table is used as an Offset.

In step 822, comparison is performed between the second transformedinput event and a reference event included in the variable length codetable, and in step 823, decision is made based on the comparison. If itis decided that a matching reference event is found, step 824 isperformed; if it is not found, step 825 is performed. If step 824 isperformed at this point, a result of coding is output which is avariable length code corresponding to the reference event to which acontrol code and a third mode code are added, followed by step 811 shownin FIG. 8(a). The third mode code is set to “10”.

On the other hand, if step 825 is performed, the coding process shown inFIG. 23 is performed to an input event to generate a fixed length code.Then, a result of coding is output which is the fixed length code towhich a control code and a first mode code are added. The first modecode is set to “11”.

If any step is performed from among step 810 and steps 824 and 825 shownin FIG. 8(b), in a subsequent step 811, it is decided whether an inputevent processed is a last input event or not, and if the event is thelast one, the coding process is completed in step 812. On the otherhand, if it is not the last one, the operation is returned to step 802after j is incremented by 1 in step 813, whereby a next input event isprocessed similarly. Thus, the process is continued to the last non-zerocoefficient.

Hereinafter a description is given of a decoding process to the codeddata obtained in the image coding process shown in the third embodiment.The configuration of an image decoding apparatus according to the thirdembodiment is identical to that of the image decoding apparatus of thefirst embodiment, and thus FIG. 4 will be used for the description.

FIG. 9 is a flowchart showing the procedure of a variable lengthdecoding method according to the third embodiment. An image decodingprocess according to the third embodiment differs from that of the firstembodiment only in the process by the variable length decoder 408 shownin FIG. 4, and thus a description is given of the operation by thevariable length decoder 408 in the decoding process with reference toFIG. 9.

Steps 901 through 906 are performed in the same manner as steps 701through 706 of the second embodiment shown in FIG. 7. When it is decidedin step 905 that a target bit is “1”, step 907 is performed in whichdecision process is performed to know whether the subsequent one bit is“0” or “1”. Then, if it is “0”, step 908 is performed, and if it is “1”,step 909 is performed.

If step 908 is performed, a set of (Last, Run, Level) corresponding toan input variable length code is obtained using a variable length codetable, and to a Run value thereof, transformation process is performedusing a prescribed function, and then the result of decoding is output.In the transformation process according to the third embodiment, aprescribed (Offset+1) is added to a resultant Run value.

On the other hand, if step 909 is performed, an input variable lengthcode is decoded as a fixed length code to regenerate coefficients. Ifany of steps 904, 906, 908, and 909 is performed, in a subsequent step910, it is decided whether an input variable length code is a last inputvariable length code or not; if it is the last one, the coding processis completed in step 911. On the other hand, if it is not the last one,the operation is returned to step 902 after j is incremented by 1 instep 912, whereby a next input variable length code is performed in thesame manner. Thus, the process is continued to the last variable lengthcode.

As described above, in the image coding method according to the thirdembodiment, if a reference event concerned is not found in a variablelength code table in the comparison process in steps 803 through 804 asshown in FIG. 8(a), transformation process is performed to an inputevent in step 806, and comparison process is performed using a resultantfirst transformed input event in steps 807 through 808; if a matchingreference event is not found in the variable length code table at thistime, the process shown in FIG. 8(b) is performed in whichtransformation process is performed to an input event in step 821, andin steps 822 through 823, comparison process is performed using aresultant second transformed input event; therefore, by performing step825, a rate of performing fixed length coding is further reduced incomparison with the respective rates of the first and secondembodiments, and a possibility that short codes are allocated invariable length coding is further increased, resulting in improved totalcompression ratio of a result of coding.

Further, since the image coding apparatus of the third embodimentcomprises a variable length coder 211 performing the above-describedcoding method, a result of coding having an improved compression ratiocan be obtained by using a single variable length code table whether thecompression ratio of the compression coding in the coder 203 is high orlow.

Furthermore, according to the image decoding method and image decodingapparatus of the third embodiment, appropriate decoding process can beperformed corresponding to the result of coding derived in theabove-described manner, to obtain reconstructed image.

Embodiment 4

An image coding method according to a fourth embodiment of the presentinvention is intended for increasing a chance of using variable lengthcode table by a comparison process using plural variable length codetables, thereby improving coding efficiency. FIG. 10 is a flowchartshowing the procedure of a variable length coding method according tothe fourth embodiment. An image coding apparatus of the fourthembodiment has the same configuration as that of the first embodiment,and thus FIG. 2 will be used for the description.

An image coding process according to the forth embodiment differs fromthat of the first embodiment only in the process by the variable lengthcoder 211 shown in FIG. 2, and thus a description is given of theoperation by the variable length coder 211 in the coding process belowwith reference to FIG. 10. Here, first and second variable length codetables are used in the coding process according to the fourthembodiment. As for the first variable length code table, the tablesshown in FIGS. 19 through 22 are used as in the first to thirdembodiments. As for the second variable length code table, on the otherhand, a table different from the first variable length code table isused, and in this case, used is the one composed of the sets havingLevel values no less than ten. As described above, in the fourthembodiment, a first variable length code table in which most of Levelvalues are less than ten is used, whereas a second variable length codetable is used including the Level values equal to or more than ten; thatis, it is preferable to use a second variable length table composed ofthe reference events not included in the first variable length table.

Following the initiation of the process in step 1001, a j-th input eventis derived in step 1002. In step 1003, comparison is performed betweenthe input event and a reference event included in a first variablelength code table in the variable length coder 211. Next, in step 1004,it is decided whether a reference event having a matching set of (Last,Run, Level) is found or not in the comparison process. If it is decidedin step 1004 that such reference event is found, step 1005 is performed;if it is not found, step 1006 is performed. If step 1005 is performed atthis point, a variable length code corresponding to the reference eventis output, followed by step 1010 which will be described.

If step 1006 is performed, on the other hand, comparison is performedbetween the input event and a reference event included in a secondvariable length code table. Then, in step 1007, it is decided whether areference event having matching (Last, Run, Level) is found or not inthe comparison process. If it is decided in step 1007 that the referenceevent is found, step 1008 is performed, and if it is not found, step1009 is performed. If step 1008 is performed at this point, a variablelength code corresponding to the reference event is obtained, and acontrol code set uniquely and a second mode code are added to the codeand output, followed by step 1010 which will be described later. In thiscase, “0000011”, which is identical to the ESC code shown in FIG. 22, isused as a control code, and “0” is used as a second mode code.

If step 1009 is performed, on the other hand, the coding process shownin FIG. 23 is performed to an input event to generate a fixed lengthcode. Then, a result of coding is output which is the fixed length codeto which a control code and a first mode code are added. “1” is used asa first mode code.

If any of steps 1005, 1008,and 1009 is performed, in a subsequent step1010, it is decided whether an input event processed is a last inputevent or not, and if it is the last one, the coding process is completedin step 1011. On the other hand, if it is not the last one, theoperation is returned to step 1002 after j is incremented by 1 in step1012, whereby a next input event is performed in the same manner. Thus,the process is continued to the last non-zero coefficient.

Hereinafter a description is given of a decoding process to the codeddata obtained in the image coding process shown in the fourthembodiment. The configuration of an image decoding apparatus accordingto the fourth embodiment is identical to that of the first embodiment,and thus FIG. 4 will be used for the description.

FIG. 11 is a flowchart showing the procedure of a variable lengthdecoding method according to the fourth embodiment. An image decodingprocess according to the fourth embodiment differs from that of thefirst embodiment only in the process by the variable length decoder 408shown in FIG. 4, and thus the operation by the variable length decoder408 in the decoding process will be described with reference to FIG. 11.

First of all, following the initiation of the process in step 1101, avariable length code of quantized transformed coefficients, which is aj-th object to be processed, is input as an input variable length code.In step 1103, it is decided whether the input variable length codeincludes a control code or not; if the control code is not included,step 1104 is performed, and if it is included, step 1105 is performed.In the case where step 1104 is performed, that is, in the case where acontrol code is not included, a set of (Last, Run, Level) correspondingto the input variable length code is output by using a first variablelength code table, followed by step 1110 which will be described later.

When it is decided in step 1103 that the control code is included,decision process is performed in step 1105 to know whether a next onebit subsequent to the control code is “0”or “1”. Then, if it is “0”,step 1106 is performed, whereas step 1108 is performed if it is “1”.

If step 1106 is performed, a set of (Last, Run, Level) corresponding tothe input variable length code is output by using the second variablelength code table, followed by step 1110 which will be described later.If step 1108 is performed, on the other hand, decoding is performed tothe input variable length code as a fixed length code to regenerate thecoefficients.

If any of steps 1104, 1106, and 1108 is performed, in a subsequent step1110, it is decided whether an input variable length code processed is alast input variable length code or not, and if it is the last one, thecoding process is completed in step 1111. On the other hand, if it isnot the last one, the operation is returned to step 1102 after j isincremented by 1 in step 1112, whereby a next input variable length codeis processed similarly. Thus, the process is continued to the lastvariable length code.

As described above, in the image coding method in accordance with thefourth embodiment, first and second variable length code tables areused, and if a reference event concerned is not found in the firstvariable length code table in a comparison process in steps 1003 through1004, a comparison process can be performed with the second variablelength code table; therefore, a rate of performing fixed length codingin step 1009 is reduced, resulting in improved whole compression ratioof a result of coding. According to the fourth embodiment, a pluralityof variable length code tables have to be prepared, and by formingplural tables so that the events included in one of the tables aredifferent from those in the other tables, coding efficiency can beimproved.

Further, since the image coding apparatus of the fourth embodimentcomprises a variable length coder 211 performing the above-describedcoding method, it is possible to obtain a result of coding havingimproved compression ratio whether the compression ratio of thecompression coding by the coder 203 is high or low.

Furthermore, according to the image decoding method and image decodingapparatus of the fourth embodiment, appropriate decoding process can beperformed corresponding to a result of coding deprived in theabove-described manner to obtain reconstructed image.

Although in the fourth embodiment two variable length code tables areused, an arbitrary number of variable length code tables may beprepared, and a corresponding number of mode codes may be used todistinguish the plural variable length code tables. Further, it ispossible to distinguish plural variable length code tables byquantization scales.

Embodiment 5

In an image coding method according to a fifth embodiment of the presentinvention, a transformation process using division process is performedto an event which is an object to be coded, and then comparison isperformed with a variable length code table.

FIG. 12 is a flowchart of the procedure of a variable length codingmethod according to the fifth embodiment. An image coding apparatusaccording to the fifth embodiment has the same configuration as that ofthe first embodiment, and thus FIG. 2 will be used for the description.

An image coding process according to the fifth embodiment differs fromthat according to the first embodiment only in the process by thevariable length coder 211 shown in FIG. 2, and thus a description isgiven of the operation of the variable length coder 211 in the codingprocess below with reference to FIG. 12. Following the initiation of theprocess in step 1201, a j-th input event consisting of (Last, Run,Level) is obtained in step 1202. Then, instep 1203, transformationprocess is performed to the input event using division process. In thetransformation process, division is performed to the Level valueincluded in an input event, using a divisor decided based on aquantization scale, to derive a quotient of the Level. FIG. 13 arediagrams illustrating relations between quantization scale and divisor.FIG. 13(a) shows an example of setting with respect to the relationbetween them, and indicates that a divisor is set to 2 when aquantization scale ranges from 1 to 7, and a divisor is 1 when aquantization scale is identical to or more than 8. This means that if aquantization scale is equal to or more than 8, division is not carriedout. FIG. 13(b) shows another example of setting with respect to therelation between them, and as shown in the figure, it is possible toclassify quantization scales into three classes and decide a divisorcorresponding to each class.

Quantization process is basically a division process, and quantizedtransform coefficients tend to have a large value as a quantizationscale decreases; accordingly, when an event is generated, the Levelvalue included in the event is often large. The variable length codetable shown in FIGS. 19 through 22 is formed so that it is suitable forthe coefficients having a relatively high compression ratio, andincludes many events having small Level values; therefore, a matchingrate for the reference events included in the table is reduced and arate of performing variable length coding is also reduced, resulting indegraded coding efficiency. Therefore, in the fifth embodiment, when thequantization scale is small, division is performed to a Level togenerate a transformed input event having a small Level value which isused for comparison process, thereby improving a rate of performingvariable length coding and increasing a possibility that short codes areallocated.

After the quotient of the Level is derived, in step 1204, comparison isperformed between (Last, Run, quotient of Level) of the transformedinput event and a reference event included in a variable length codetable, and in a subsequent step 1205, decision process is carried outaccording to the result of the comparison. If it is decided in step 1205that such reference event is found, step 1206 is performed; if it is notfound, step 1208 is performed.

If step 1207 is performed, the variable length code for the referenceevent concerned is output, and in a subsequent step 1208, the remainderof the Level is subjected to fixed length coding and the result of thecoding is output as an input auxiliary code. The code length of theremainder of the Level is changed depending on a divisor. For example,in the case of the setting shown in FIG. 13(a), the bit length of aremainder is set to 1 when a divisor is 2, and the bit length of theremainder is set to 0 when the divisor is 1. In other words, when adivisor is 1, a remainder is actually not coded. If steps 1207 through1208 are performed, a variable length code and an input auxiliary codeare output as the results of coding.

On the other hand, if step 1206 is performed, fixed length codingprocess is performed to an input event to generate a fixed length code.Then, the result of the coding is output which is the fixed length codeto which a control code is added.

After performing steps 1207 through 1208 or step 1206, in a subsequentstep 1209, it is decided whether an input event processed is the lastinput event or not, and if it is the last one, the coding process iscompleted in step 1210. On the other hand, if it is not the last one,the operation is returned to step 1202 after j is incremented by 1 instep 1211, whereby a next input event is performed in the same manner.Thus, the process is continued to the last non-zero coefficient.Hereinafter a description is given of a decoding process to the codeddata obtained by the image coding process shown in the fifth embodiment.The configuration of an image decoding apparatus according to the fifthembodiment is identical to that of the first embodiment, and thus FIG. 4will be used for the description.

FIG. 14 is a flowchart showing the procedure of a variable lengthdecoding method according to the fifth embodiment. An image decodingprocess according to the fifth embodiment differs from that of the firstembodiment only in the process by the variable length decoder 408 shownin FIG. 4, and thus a description is given of the operation by thevariable length decoder 408 in the decoding process below with referenceto FIG. 14.

First of all, following the initiation of the process in step 1401, avariable length code of quantized transform coefficients, which is aj-th object to be processed, is input as an input variable length codein step 1402. Since the result of coding including an input auxiliarycode is obtained as described in the image coding process of the fifthembodiment, the input auxiliary code is also input together with thevariable length code as an object to be processed at this point. In step1403, it is decided whether the input variable length code includes acontrol code or not; if it is included, step 1404 is performed, and ifit is not included, step 1405 is performed. In the case where step 1404is performed, that is, in the case where the control code is included,the input variable length code is decoded as a fixed length code toregenerate and output coefficients, followed by a subsequent step 1408which will be described.

On the other hand, in the case where step 1405 is performed, that is, inthe case where the control code is not included, a set of (Last, Run,Level) corresponding to the input variable length code is derived byusing a first variable length code table, and then step 1406 isperformed in which transformation process is performed by multiplyingthe derived Level value with a prescribed value. The prescribed value isdecided based on a quantization scale, and in this case, the value shownin FIG. 13 is used corresponding to the coding process. Then, in step1407, the input auxiliary code is subjected to fixed length decoding toobtain a remainder of the Level, and the remainder is added to a productderived from the transformation process in step 1406 to obtain a correctLevel value, and the set of (Last, Run, Level) in which this Level valueis used is output as the result of decoding.

After performance of step 1404 or steps 1405 through 1407, in asubsequent step 1408, it is decided whether an input variable lengthcode processed is a last input variable length code or not; if it is thelast one, the coding process is completed in step 1409. On the otherhand, if it is not the last one, the operation is returned to step 1402after j is incremented by 1 in step 1410, whereby a next input variablelength code is processed in the same manner. Thus, the process iscontinued to the last variable length code.

As described above, in the image coding method according to the fifthembodiment, as shown in step 1203 of FIG. 12, transformation process isperformed in which division is performed to the Level value included inan input event which is an object to be processed, using a numberdecided based on a quantization scale, and in step 1204, comparisonprocess is performed using a transformed input event which has beensubjected to the transformation process; therefore, a matching rate forreference events included in a variable length code table is increasedand a rate of performing fixed length coding in step 1206 is reduced,and a possibility that short codes are allocated in variable lengthcoding is increased as well by using a variable length code, resultingin improved coding efficiency.

Further, since the image coding apparatus of the fifth embodimentcomprises a variable length coder 211 performing the above-describedcoding method, it is possible to obtain a result of coding havingimproved compression ratio by using a single variable length code tablewhether the compression ratio of the compression coding by the coder 203is high or low.

Furthermore, according to the image decoding method and image decodingapparatus of the fifth embodiment, appropriate decoding process can beperformed corresponding to the result of coding derived in theabove-described manner to obtain reconstructed image.

Although in the fifth embodiment it is described that transformationprocess is performed to Level included in an event, the transformationprocess may be performed to Run in place of Level.

Embodiment 6

In an image coding method according to a sixth embodiment of the presentinvention, in place of an input event, transformation process isperformed to a reference event, and then comparison is performed.

FIG. 15 is a flowchart showing the procedure of a variable length codingmethod according to the sixth embodiment. An image coding apparatusaccording to the sixth embodiment also has the same configuration asthat of the first embodiment, and thus FIG. 2 will be used for thedescription.

An image coding process according to the sixth embodiment differs fromthat of the first embodiment only in the process by the variable lengthcoder 211 shown in FIG. 2, and thus a description is given of theoperation by the variable length coder 211 in the coding process belowwith reference to FIG. 15. Following the initiation of the process instep 1501, in step 1502, a j-th input event consisting of (Last, Run,Level) is obtained. A quantization scale used in quantization process isalso input. In step 1503, an i-th reference event is taken from avariable length code table, and in step 1504, the reference event issubjected to transformation process to generate a transformed referenceevent.

In the sixth embodiment, as the transformation process, an Offset, whichis set according to the quantization scale input in step 1502, is addedto a Level value included in a reference event. In this case, setting isperformed in such a way that Offset=5 when quantization scale is 1 or 2,Offset=4 when quantization scale is 3 or 4, Offset=3 when quantizationscale is 5 or 6, Offset=2 when quantization scale is 7 or 8, Offset=1when quantization scale is 9 or 10, and Offset=0 when quantization scaleis equal to or more than 11. For example, in the case where an event asan object to be coded is (Last, Run, Level)=(0, 1, 6), if transformationprocess to reference event is not performed, this means that a matchingreference event is found in the reference events shown in FIG. 19; acode corresponding to it is used, and the result of coding obtained is13 bits. On the other hand, in the case where quantization scale is 4and the same event is used as the object, a transformation process inwhich 4 is added to the Level value is performed to all of the referenceevents; a variable length code corresponding to the reference event (0,1, 2) shown in FIG. 19 is used and thus 7 bits are obtained, which meansthat 6 bits are saved in comparison with the case in which theabove-described transformation process is not performed. Therefore,adding an Offset to the Level of a reference event is identical to amethod of deducting an Offset from the Level of an event (Last, Run,Level) which is an object to be coded and comparing it with each set ofa variable length code table.

As described in the fifth embodiment, since a value of a quantizedcoefficient tends to increase as a quantization scale decreases, afrequency at which an event having a large Level value appears is alsoincreased. On the other hand, the variable length code table shown inFIGS. 19 through 22 is suitable for coefficients having a highcompression ratio, and include many events having small Level values.Therefore, adding an Offset to a Level value included in a referenceevent can raise a rate of performing variable length coding using shortcodes, thereby improving the compression ratio.

In step 1505, decision process is performed based on the result of thecomparison instep 1504. If the decision in step 1505 shows a match, step1507 is carried out after the performance of step 1506, where a variablelength code corresponding to the i-th reference event is output,followed by step 1509 which will be described later. On the other hand,if no match is found, step 1507 is performed.

In step 1507, it is decided whether the i-th reference event is a lastreference event included in the variable length cod table; if it is thelast reference event, step 1508 is performed. If it is not the lastreference event, the operation is returned to step 1503 after i isincremented by 1 in step 1512, and the following steps ending with thedecision in step 1507 are performed again.

By the processes in steps 1503 through 1507, the comparison between aj-th input event and a reference event included in the variable lengthcode table is repeated until the decision in step 1505 shows a matchbetween them or it is decided in step 1507 that the treated event is thelast one. In other words, the comparison is continued until variablelength coding is performed or the last one of the variable length codetable is compared.

In the case where it is decided in step 1507 that the treated event isthe last one, that is, in the case where the comparison using the tableis completed for the j-th input event, it is found that variable lengthcoding cannot be performed and in step 1508, fixed length coding isperformed to the input event to output the result of the coding with acontrol code, followed by step 1509.

In step 1509 performed subsequent to step 1506 or step 1508, it isdecided whether an input event processed is a last input event or not;if it is the last one, the coding process is completed in step 1510. Ifit is not the last one, on the other hand, the operation is returned tostep 1502 after j is incremented by 1 in step 1511, whereby a next inputevent is processed in the same manner. Thus, the process is continued tothe last non-zero coefficient.

FIG. 16 is a block diagram illustrating the inner configuration of thevariable length coder (211 in FIG. 2) used in an image coding apparatusaccording to the sixth embodiment of the present invention. As shown inthe figure, the variable length coder comprises: a variable length codetable 1601, a Level transformation unit 1602, a comparator 1603, a fixedlength coder 1604, and a switch 1605, and receives an input event and aquantization scale as inputs and outputs a result of coding.

The variable length code table 1601 is shown in FIGS. 19 through 22. TheLevel transformation unit 1602 receives a quantization scale and areference event as inputs and transforms a Level value of the referenceevent corresponding to the quantization scale to generate a transformedreference event. The comparator 1603 performs comparison process betweenan input event and the transformed reference event and outputs a controlsignal according to the result of the comparison. The fixed length coder1604 performs fixed length coding process to an input event when it isinput, and outputs the result of the coding. The switch 1605 performsswitching according to an output from the comparator 1603 and outputs,as a result of coding, one of an output from the variable length codetable 1601 and an output from the fixed length coder 1604.

Hereinafter a description is given of the operation of the variablelength coder thus constructed, corresponding to the flow of FIG. 15. Instep 1502 of the flow of FIG. 15, when a quantization scale and an inputevent (a j-th one) are input to the variable length coder (211 in FIG.2), the quantization scale is input to the Level transformation unit1602 through a line 1611 and the input event is input to the comparator1603 through a line 1612. In step 1503 of the flow of FIG. 15, the Leveltransformation unit 1602 derives a reference event (an i-th one) fromthe variable length code table through a line 1613, performstransformation process to the Level value included in the referenceevent using the input quantization scale, and outputs a resultanttransformed reference event to the comparator 1603.

In step 1505 of the flow of FIG. 15, comparison process and decisionprocess are performed by the comparator 1603. The comparator 1603performs comparison process between the input event and the transformedreference event which are input, and decides whether these events matchor not. If the decision is “matching”, the comparator 1603 sends acontrol signal to the variable length code table 1601 through a line1615 so that a code corresponding to the i-th reference event is output,while sending a control signal to the switch 1605 through a line 1617 sothat the output from the variable length code table 1601 is output fromthe switch 1605. Therefore, if the decision in step 1505 shows“matching”, in step 1506 of the flow of FIG. 15, a variable length codeis output from the output line 1620 of the switch 1605.

On the other hand, if it is found in the comparison process by thecomparator 1603 that those events do not match, a next reference event(i+1-th one) is input from the variable length code table 1601 to theLevel transformation unit 1602, in response to a control signal throughthe line 1615. In the flow of FIG. 15, the steps starting with step 1503are performed again after “i” is incremented in step 1512.

When it is checked from the decision in step 1507 that the comparisonprocess is completed for the last one of the variable length code table,the comparator 1603 outputs the input event (the j-th one) to the fixedlength coder 1604 through a line 1618, while sending a control signal tothe switch 1605 through a line 1617 so that the output from the fixedlength coder 1604 is used as a code from the switch 1605.

In 1508 of the flow of FIG. 15, the fixed length coder 1604 performscoding process to the input event input and outputs an obtained resultof coding to the switch 1605 through a line 1619. According to thecontrol signal from the comparator 1603, a fixed length code is outputfrom the switch 1605 through the line 1620.

Following the output from the line 1620, a next input event is inputthrough the line 1612, whereby the processes to input event in the flowof FIG. 15 is executed again.

The image coding according to the sixth embodiment of the presentinvention is thus performed, whereas a decoding process to the codeddata obtained by such image coding is performed in an image decodingapparatus shown in FIG. 4. An image decoding process according to thesixth embodiment differs from that of the first embodiment only in theprocess by the variable length decoder 408 shown in FIG. 4, and thus adescription is given of the decoding process by the variable lengthdecoder 408 below, with reference to FIG. 17 showing the innerconfiguration thereof.

As shown in FIG. 17, the variable length decoder comprises: a variablelength code table 1701, a comparator 1702, a Level inversetransformation unit 1703, a fixed length decoder 1704, and a switch1705, and it receives an input variable length code and a quantizationscale as inputs and outputs a result of regeneration derived from thedecoding process.

The variable length code table 1701 is shown in FIGS. 19 through 22. Thecomparator 1702 performs comparison process between an input variablelength code and a reference variable length code and outputs a controlsignal corresponding to the result of comparison. The Level inversetransformation unit 1703 receives a quantization scale and a referenceevent as inputs, transforms a value of a Level included in the referenceevent corresponding to the quantization scale to generate a transformedreference event. The fixed length decoder 1704 performs fixed lengthdecoding process to an input variable length code when it is input andoutputs the result of the decoding. The switch 1705 performs switchingcorresponding to the output from the comparator 1702 and outputs, as aresult of regeneration, one of the output from the variable length codetable 1701 and the output from the fixed length decoder 1704.

Hereinafter a description is given of the operation of the variablelength decoder thus constructed. When a quantization scale and an inputvariable length code are input to the variable length decoder (408 inFIG. 4), the quantization scale is input to the Level inversetransformation unit 1703 through a line 1711, and the input variablelength code is input to the comparator 1702 through a line 1712. Thecomparator 1702 derives a reference variable length code from thevariable length code table 1701 through a line 1713 and performscomparison between the input variable length code and the referencevariable length code.

If the result of the comparison is that these codes match, thecomparator 1702 sends a control signal to the variable length code table1701 through a line 1714 so that a reference event corresponding to thereference variable length code is output, while sending a control signalto the switch 1705 through a line 1717 so that the code from thevariable length code table 1701 is output from the switch 1705.

From the variable length code table, a reference event is input to theLevel inverse transformation unit 1703 through a line 1715 to besubjected to transformation process. The Level inverse transformationunit 1703 performs the inverse of the transformation process performedfor coding, corresponding to the Level included in the reference eventbased on a quantization scale. In the sixth embodiment, an Offsetpredetermined according to a quantization scale is added to the Levelvalue included in a reference value. This is performed in such a waythat Offset=5 when quantization scale is 1 or 2, Offset=4 whenquantization scale is 3 or 4, Offset=3 when quantization scale is 5 or6, Offset=2 when quantization scale is 7 or 8, Offset=1 whenquantization scale is 9 or 10, and Offset=0 when quantization scale isequal to or more than 11. For example, when an input variable lengthcode is “0101000”, (Last, Run, Level)=(0, 1, 2) is derived as areference event from a table shown in FIG. 19. The Level inversetransformation unit 1703 adds 4 to the Level included in this referenceevent input if the input quantization scale is 4, and outputs theobtained result (0, 1, 6) to the switch 1705 through a line 1716. Then,corresponding to the control signal from the comparator 1702, the switch1705 outputs this result as a result of regeneration through the line1720. When the decision shows “matching”, a variable length code isoutput from the output line 1720 of the switch 1705.

On the other hand, when no matching variable length code is found in thecomparison process by the comparator 1702, the comparator 1702 outputsthe input variable length code to the fixed length decoder 1704 througha line 1718, while sending a control signal to the switch 1705 throughthe line 1717 so that a code from the fixed length decoder 1704 isoutput from the switch 1705. Thereby, a result of fixed length decodingis output from the output line 1720 of the switch 1705.

Thus, according to the image coding method according to the sixthembodiment, the transformation process shown in step 1502 of FIG. 15 isperformed to a reference event included in a variable length code table;therefore, a rate of performing variable length coding and a rate atwhich short codes are allocated are increased as in the first embodimentwhere the same transformation process is performed to input event,resulting in improved coding efficiency.

Further, since the image coding apparatus according to the sixthembodiment comprises a variable length coder 211 having the innerconfiguration shown in FIG. 16 and implementing the above-describedcoding method, a result of coding having improved compression ratio canbe obtained using a single variable length code table whether thecompression ratio of the compression coding by the coder 203 is high orlow.

Furthermore, by the image decoding method and image decoding apparatusaccording to the sixth embodiment, appropriate decoding process can beperformed corresponding to the result of coding derived in theabove-described manner to obtain a reconstructed image.

Although in the sixth embodiment a method of adding Offset is used as atransformation process to reference event, the process is not limited tothis method only and other functions may be applied. For example, theabove-described effect can be obtained by the following methods:changing a multiple to a Level value according to a quantization scale;subjecting to quadratic function; and changing a dynamic range of aLevel.

Further, as is illustrated in the description of the transformationprocess to input event in the first embodiment as well as in otherembodiments, it is possible to perform transformation process to a valueof Run of a reference event, in place of a transformation process to aLevel thereof.

As described in the embodiments of the present invention, in any of theembodiments, the procedure presented referring to the flowchart thereofis just one example, and other procedure implementing the same codingand decoding methods may be used.

Furthermore, the image coding apparatuses and image decoding apparatusesof the first through sixth embodiments of the present invention arerealized by recording, in recording media, an image coding programimplementing the image coding methods of the respective embodiments andan image decoding program implementing the image decoding methods of therespective embodiments, and running the recorded programs on a computersystem including a personal computer and a work station. Recording mediacapable of recording such programs may be employed: for example, floppydisks or optical disks such as CD-ROM.

Industrial Availability

As described above, the image coding methods and image codingapparatuses of the present invention are able to perform coding processat a high compression ratio to a wide range of objects having variouscompression ratios, using a single variable length code table, when anobject to be processed is the data compression-coded by subjectingdigital image data to DCT or waveform coding.

Further, the image decoding methods and image decoding apparatuses ofthe present invention are able to perform appropriate decoding processto a result of coding which has been subjected to the above-describedefficient coding process, to obtain reconstructed images.

Furthermore, a recording medium containing an image coding program and arecording medium containing an image decoding program according to thepresent invention are able to implement an image coding apparatuscapable of obtaining a result of coding with a high compression ratioand an image decoding apparatus capable of appropriately processing theresult of coding, utilizing a device resource fully, by running therecorded programs on a computer system.

What is claimed is:
 1. An image coding method in which variable lengthcoding process is performed to transform coefficients by referring to avariable length code table comprising a plurality of reference events,consisting of Last, Run Level, paired with reference variable lengthcodes, wherein the variable length coding process comprises: obtainingan input event consisting of Last Run, Level corresponding to saidtransform coefficients, comparing said input event with a referenceevent in said table, and if said input event accords with maid referenceevent, outputting a variable length cede corresponding to said referenceevent, and if said input event does not accord with any reference eventsin said table, obtaining a second transformed input event, bytransforming the Run value of said input event using a predeterminedfunction, comparing said second transformed input event with a referenceevent in said table, and if said second transformed input event accordswith said reference event, outputting a contra code and a third modecode followed by a variable length code corresponding to said referenceevent, and if said second transformed input event doe not accord withany reference events in said table, obtaining a first transformed inputevent, by transforming the Level value of said input event using apredetermined function, comparing said first transformed input eventwith a reference event in said table, and if said first transforms inputevent accords with said reference event, outputting a control code and asecond mode code followed by a variable length code corresponding tosaid reference event, and if said first transformed input event does notaccord with any reference events, outputting a control code an a firstmode code followed by a fixed length code corresponding to said inputevent.
 2. The image coding method according to claim 1, wherein thecontrol code is “0000011”, the first mode code is “11”, the second modecode is “0” and the third mode code is “10”.
 3. The image coding methodaccording to claim 1, wherein the predetermined function fortransforming the Level value is defined as: the transformed Levelvalue=sign(the resultant Level value)×(abs(the resultant Level value)−apredetermined Offset value).
 4. The image coding method according toclaim 1, wherein the predetermined function for transforming he Runvalue is defined as: the transformed Run Value=the resultant RunValue−(a predetermined Offset value+1).